<script setup>


function myRequest (resData) {
  const copyFile = new File([resData.file], "l234" + resData.file.name)
  const form = new FormData()
  form.append('file', copyFile)
  // updateUserAvatar(form).then(res => {
  //   console.log(res.data)
  //   imageUrl.value = 'http://localhost:8080/' + res.data.data
  // })
}
</script>

<template>
  <a-upload
      v-model:file-list="fileList"
      name="file"
      list-type="picture-card"
      class="avatar-uploader"
      :show-upload-list="false"
      :custom-request="myRequest"
  >
    <img v-if="imageUrl" :src="imageUrl" alt="avatar" />
    <div v-else>
      <loading-outlined v-if="loading"></loading-outlined>
      <plus-outlined v-else></plus-outlined>
      <div class="ant-upload-text">Upload</div>
    </div>
  </a-upload>
</template>

<style scoped>

</style>